<?php
/**
 * View padrão de uma página do site
 */
$request = Zend_Controller_Front::getInstance()->getRequest();
$controlador = $request->getControllerName();
$action = $request->getActionName();
?>
<script type="text/javascript">
$(function () {
	$('.pagina.<?php echo $controlador; ?>.<?php echo $action; ?> .menuInterno a').click( function(){
		$('.pagina.<?php echo $controlador; ?>.<?php echo $action; ?> .conteudoInterno').load($(this).attr('href'));
		return false;
	});
});
</script>
<div class="pagina <?php echo $controlador; ?> <?php echo $action; ?>">
	<div class="menuInterno">
		<h1><?php echo $this->titulo; ?></h1>
		<ul>
<?php 
foreach((array)$this->menu as $url => $titulo){
?>
			<li><a href="<?php echo $this->baseUrl($url); ?>" class="<?php echo ($url == $controlador . '/' . $action) ? 'ativo' : ''; ?>" ><?php echo $titulo; ?></a></li>
<?php 
}
?>
		</ul>
	</div>
	<div class="conteudoInterno">
<?php
if (!$request->isXmlHttpRequest() && $action != 'index') { 
	try {
		echo $this->render($controlador . '/' . $action . '.phtml', null, false);
	}
	catch (Exception $e) {
		echo $e;
	}
}
else {
?>
<script type="text/javascript">
$(function(){
	// ao renderizer o index, abre o primeiro sub-menu.
	$('.pagina.<?php echo $controlador; ?>.<?php echo $action; ?> .menuInterno a:first').click();
});
</script>
<?php
}
?>
	</div>
</div>